﻿@namespace BootstrapBlazor.Components
@inherits BootstrapInput<string>

@if (IsShowLabel)
{
    <label class="control-label" required="@Required" for="@Id">@DisplayText</label>
}
<div class="@ClassString">
    <input @attributes="AdditionalAttributes" class="@ClassName" autocomplete="off" type="text" placeholder="@PlaceHolder" @bind-value="@CurrentValueAsString" @bind-value:event="oninput" @onblur="@OnBlur" @onkeyup="@OnKeyUp" />
    <i class="fa fa-spinner fa-spin fa-fw"></i>
    <div class="select-dropdown">
        <ul class="dropdown-list">
            @if (FilterItems.Any())
            {
                @foreach (var item in FilterItems)
                {
                    <li class="@ItemClassString(item)" @onmousedown="@(async e => await OnItemClick(item))">
                        <div>@item</div>
                    </li>
                }
            }
            else
            {
                <li class="dropdown-item">@NoDataTip</li>
            }
        </ul>
    </div>
</div>
<CascadingValue Value="this" IsFixed="true">
    @ChildContent
</CascadingValue>
